package year2019.month12;

/**
 * @desc 描述
 * create on 2018/12/27 by watson
 */
public class SingleTon {
    private String name;

    private SingleTon(){}

    private static class SingleTonHoler{
        private static SingleTon INSTANCE = new SingleTon();
    }

    public static SingleTon getInstance(){
//        SingleTon.getInstance();
        return SingleTonHoler.INSTANCE;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args){
        SingleTon singleTon = SingleTon.getInstance();
        singleTon.setName("Test On");
        System.out.println(singleTon.getName());
    }

}
